package com.DHH.Service.Order.Impl;
import com.DHH.Entity.Order.OrderInfo;
import com.DHH.Mapper.Order.OrderInfoMapper;
import com.DHH.Service.Order.IOrderInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class OrderInfoServiceImpl implements IOrderInfoService{
	
	@Autowired
    private OrderInfoMapper orderInfoMapper;
    
   @Override
   public OrderInfo insertOrderInfo(OrderInfo orderInfo){
	   
        orderInfoMapper.insertSelective(orderInfo);
	   return orderInfo;
	   
   };
   @Override
   public OrderInfo updateOrderInfo(OrderInfo orderInfo){
	     orderInfoMapper.updateByPrimaryKeySelective(orderInfo);
        return orderInfo;
   };
   @Override
   public OrderInfo deleteOrderInfo(OrderInfo orderInfo){

	     orderInfoMapper.delete(orderInfo);
        return orderInfo;
   };
    /**
     * 保存或更新操作，返回值为主表
     */
    public OrderInfo saveOrUpdateOrderInfo(OrderInfo orderInfo){
        if(orderInfo.getId()==null)
        {
            orderInfoMapper.insertSelective(orderInfo);
        }else{
            orderInfoMapper.updateByPrimaryKeySelective(orderInfo);
        }
        return orderInfo;
    };
}
